package com.glodon.paas.job.agent.worker;

import static com.glodon.paas.job.JobConstants.*;

import com.glodon.paas.job.agent.cli.GnuCli;

public class DefaultWorkerFactory implements WorkerFactory {
    private GnuCli cli = new GnuCli();

    public DefaultWorkerFactory() {
        cli.addParamNames(INPUT, OUTPUT, PROPERTY_TASK_ID);
    }

    @Override
    public Worker createWorker(Caller caller, String cmd, String[] envp) {
        DefaultWorker worker = new DefaultWorker();
        worker.setCli(cli);
        worker.setCmd(cmd);
        worker.setEnvp(envp);
        worker.setCaller(caller);
        return worker;
    }
}
